//
//  LMJScrollViewController.m
//  Bees
//
//  Created by NowYouCanSee on 2018/12/28.
//  Copyright © 2018 xiaohan. All rights reserved.
//

#import "LMJScrollViewController.h"

@interface LMJScrollViewController ()<UIScrollViewDelegate>
@end

@implementation LMJScrollViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupBaseUI];
}
-(void)setupBaseUI{
     [self.scrollContentView addSubview:self.contentView];
     [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.centerX.left.right.bottom.top.mas_equalTo(0);
//         make.height.mas_equalTo(kScreenHeight-kTopHeight);
     }];
}

- (void)viewWillLayoutSubviews{
    [super viewWillLayoutSubviews];
    [self.scrollContentView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.customNavigationBar.mas_bottom);
        make.left.bottom.right.mas_equalTo(0);
    }];
}
#pragma mark - scrollDeleggate
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    UIEdgeInsets contentInset = self.scrollContentView.contentInset;
    contentInset.bottom -= self.scrollContentView.mj_footer.height;
    self.scrollContentView.scrollIndicatorInsets = contentInset;
    [self.view endEditing:YES];
}

- (XHFullPopContentScrollView*)scrollContentView{
    if (!_scrollContentView) {
        _scrollContentView = [[XHFullPopContentScrollView alloc]initWithFrame:CGRectMake(0, self.customNavigationBar.height, self.view.width, self.view.height-self.customNavigationBar.height)];
        _scrollContentView.delegate = self;
        [self.view addSubview:_scrollContentView];
    }
    return _scrollContentView;
}
- (UIView*)contentView{
    if (!_contentView) {
        _contentView = [UIView new];
        _contentView.backgroundColor = [UIColor whiteColor];
    }
    return _contentView;
}
@end
